package com.ysqcould.content.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ysqcould.common.utils.DateUtils;
import com.ysqcould.content.domain.Notice;
import com.ysqcould.content.mapper.NoticeMapper;
import com.ysqcould.content.service.INoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 协会公告Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-06-28
 */
@Service
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper,Notice> implements INoticeService
{
    @Autowired
    private NoticeMapper tNoticeMapper;

    /**
     * 查询协会公告
     * 
     * @param id 协会公告主键
     * @return 协会公告
     */
    @Override
    public Notice selectTNoticeById(Long id)
    {
        return tNoticeMapper.selectTNoticeById(id);
    }

    /**
     * 查询协会公告列表
     * 
     * @param tNotice 协会公告
     * @return 协会公告
     */
    @Override
    public List<Notice> selectTNoticeList(Notice tNotice)
    {
        return tNoticeMapper.selectTNoticeList(tNotice);
    }

    /**
     * 新增协会公告
     * 
     * @param tNotice 协会公告
     * @return 结果
     */
    @Override
    public int insertTNotice(Notice tNotice)
    {
        tNotice.setCreateTime(DateUtils.getNowDate());
        return tNoticeMapper.insertTNotice(tNotice);
    }

    /**
     * 修改协会公告
     * 
     * @param tNotice 协会公告
     * @return 结果
     */
    @Override
    public int updateTNotice(Notice tNotice)
    {
        tNotice.setUpdateTime(DateUtils.getNowDate());
        return tNoticeMapper.updateTNotice(tNotice);
    }

    /**
     * 批量删除协会公告
     * 
     * @param ids 需要删除的协会公告主键
     * @return 结果
     */
    @Override
    public int deleteTNoticeByIds(Long[] ids)
    {
        return tNoticeMapper.deleteTNoticeByIds(ids);
    }

    /**
     * 删除协会公告信息
     * 
     * @param id 协会公告主键
     * @return 结果
     */
    @Override
    public int deleteTNoticeById(Long id)
    {
        return tNoticeMapper.deleteTNoticeById(id);
    }

    @Override
    public int updateUserStatus(Notice notice) {
        Notice one = tNoticeMapper.getNotice(notice);
        one.setStatus(2L);
        return tNoticeMapper.updateTNotice(one);
    }

}
